﻿using System.IO;
using UnityEngine;

namespace Yoozoo.Gta.ProjBuilder
{
    [HelpURL("https://youzu.feishu.cn/docx/NxR9dWOGoo4D8wxOSKxcV8i5nhb")]
    public class SubPackageCollector : MonoBehaviour
    {
        [Header("收集前先打包图集(看上面那个按钮↑↑↑)")]
        [Header("收集首包资源")]
        public bool CollectFirstPackage = false;

        [Header("收集资源的Tag")]
        public string Tag = "Route1";

        [Header("收集前是否清空数据")]
        public bool CleanUp = true;

#if UNITY_EDITOR
        public void Collect()
        {
            if (CollectFirstPackage)
            {
                if (CleanUp)
                {
                    string configPath = $"Assets/ResourceCustomConfigs/{Tag}PackedAssetCollection.xml";
                    if (File.Exists(configPath))
                        UnityEditor.AssetDatabase.DeleteAsset(configPath);
                }

                SubPackageTool.CollectFirstPackageAssets(Tag);
            }
        }
#endif

        public void AddResourceName(string resourceName)
        {

        }
    }
}
